home *** CD-ROM | disk | FTP | other *** search
/ BMUG Revelations / BMUG Revelations.toast / Utilities / Text and Speech / BBEdit 2.2.2 / BBEdit Extensions / Sources / Concat.c < prev    next >
C/C++ Source or Header  |  1992-09-12  |  834b  |  45 lines

  1. #include <Aliases.h>
  2.  
  3. #include "ExternalInterface.h"
  4.  
  5. pascal void main(ExternalCallbackBlock *callbacks, WindowPtr w)
  6. {
  7.     Handle text, file;
  8.     StandardFileReply reply;
  9.     
  10.     Boolean scratch;
  11.     short i;
  12.     
  13.     Boolean dispose;
  14.     
  15.     short count;
  16.     StandardFileReply **files;
  17.     
  18.     if (callbacks->OpenSeveral(FALSE, &count, &files)) {
  19.     
  20.         text = callbacks->Allocate(0, FALSE);
  21.         
  22.         for (i = 0; i < count; i++) {
  23.             reply = (*files)[i];
  24.             
  25.             if (reply.sfFlags & 0x8000)
  26.                 ResolveAliasFile(&reply.sfFile, TRUE, &scratch, &scratch);
  27.                 
  28.             file = callbacks->GetFileText(reply.sfFile.vRefNum, reply.sfFile.parID, reply.sfFile.name,
  29.                 &dispose);
  30.             
  31.             if (file) {
  32.                 HandAndHand(file, text);
  33.                 if (dispose)
  34.                     DisposHandle(file);
  35.             };
  36.         };
  37.         
  38.         if (count)
  39.         {
  40.             w = callbacks->NewDocument();
  41.             callbacks->SetWindowContents(w, text);
  42.         }
  43.     }
  44. }
  45.